/**
 * Copyright 2012 Fonfon.Fenceer
 * All rights reserved.
 * 
 * @project 
 * @author Fonfon.Fenceer
 * @version 1.0
 * @data 2012-3-14
 */
package com.guidecaptain.java.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.guidecaptain.core.base.action.BaseAction;
import com.guidecaptain.java.model.pojo.Guide;
import com.guidecaptain.java.model.pojo.Guidefm;
import com.guidecaptain.java.model.vo.GuidefmVO;
import com.guidecaptain.java.service.GuideService;
import com.guidecaptain.java.service.GuidefmService;

/**
 * 
 * @author fenceer
 */
@Controller
@Scope("prototype")
public class GuidefmAction extends BaseAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Autowired
	private GuidefmService guidefmService;
	@Autowired
	private GuideService guideService;
	
	private GuidefmVO guidefmVO=new GuidefmVO();

	public String insertGuidefm(){
		if(this.guidefmService.insertGudiefm(guidefmVO.getGuidefmList())){
			
			return "insert";
		}else {

			return "fail";
		}
	}
	
	public String updateGudie(){
		return null;
		
	}
	
	/**
	 * 查询导游领队家庭成员信息
	 */
	public String queryGuidefmList(){
		Guide guide = guideService.queryGuideById(guidefmVO.getGuideId());
		guidefmVO.setGuide(guide);
		List<Guidefm> guidefms=guidefmService.queryGuidefmList(guidefmVO.getGuideId());
		guidefms=guidefms.size()>0?guidefms:null;
		guidefmVO.setGuidefmList(guidefms);
		
		return "guidefmList";
	}
	
	/** 
	 * @param 
	 * @return 
	 */
	@Override
	public Object getModel() {
		
		return guidefmVO;
	}

}
